﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using Novacode;
using System.Data;
using JasRibbonApplicatie.Classes;
using JasRibbonApplicatie.Model;

namespace JasRibbonApplicatie.Views.BeheerAanvragen
{
    /// <summary>
    /// Interaction logic for FormulierenAanvragen.xaml
    /// </summary>
    public partial class FormulierenAanvragen : Page
    {
        string docx = "";
        private static AanvraagModel am = new AanvraagModel();
        public FormulierenAanvragen()
        {
            InitializeComponent();
            maakIngevuld();
        }


        private void maakIngevuld()
        {
            
        }

        // You need to rewrite this function to grab data from your data source.
        private DataTable GetDataFromDatabase()
        {
            DataTable table = new DataTable();
            table.Columns.AddRange(new DataColumn[] { new DataColumn("Materiaal"), new DataColumn("Aantal"), new DataColumn("Prijs per stuk"), new DataColumn("Subtotaal"), new DataColumn("Periode"), new DataColumn("Totaal"), new DataColumn("Waarborg") });

            table.Rows.Add
            (
                "Microstatief",
                "4",
                "€ 0,00",
                "€ 0,00",
                "1w1d",
                "€ 0,00",
                "€ 0,00"
            );

            table.Rows.Add
            (
                "Micro",
                "4",
                "€ 1,00",
                "€ 4,00",
                "1w1d",
                "€ 20,00",
                "€ 0,00"
            );

            table.Rows.Add
            (
                "Signaal kabel (XLR)",
                "4",
                "€ 0,00",
                "€ 0,00",
                "1w1d",
                "€ 0,00",
                "€ 0,00"
            );


            return table;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            docx = Formulieren.createVoorlopigFormulier(am.GetAanvraagById(3), am);
            docx = System.IO.Path.GetFullPath(docx);
            if (docx != "")
                Formulieren.docxToPdf(docx, docx.Substring(0, docx.Length - 4) + "pdf");
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            docx = Formulieren.createDefinitiefFormulier(am.GetAanvraagById(3), am);
            docx = System.IO.Path.GetFullPath(docx);
            if (docx != "")
                Formulieren.docxToPdf(docx, docx.Substring(0, docx.Length - 4) + "pdf");
                
        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {
            docx = Formulieren.createMateriaalBuitenFormulier(am.GetAanvraagById(3), am);
            docx = System.IO.Path.GetFullPath(docx);
            if (docx != "")
                Formulieren.docxToPdf(docx, docx.Substring(0, docx.Length - 4) + "pdf");
        }


    }
}
